//
//  WQStatusTabbar.swift
//  sanwuWeibo
//
//  Created by 王先强 on 15/12/10.
//  Copyright © 2015年 王先强. All rights reserved.
//

import UIKit

class WQStatusTabbar: UIView {


    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    private func setupUI() {
        
        self.backgroundColor = randomColor
        addSubview(retweetedButton)
        addSubview(commentButton)
        addSubview(likeButton)
        
        retweetedButton.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(self.snp_left)
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)

        }
        commentButton.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetedButton.snp_right)
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)
            make.width.equalTo(retweetedButton.snp_width)
        }
        likeButton.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(commentButton.snp_right)
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)
            make.width.equalTo(retweetedButton.snp_width)
            make.right.equalTo(self.snp_right)
        }
        
        /// 分割线
        let separator1 = separatorView()
        let separator2 = separatorView()
        addSubview(separator1)
        addSubview(separator2)
        
        let scale = 0.45
        let lineW = 0.5
        
        separator1.snp_makeConstraints { (make) -> Void in
            make.centerY.equalTo(self.snp_centerY)
            make.height.equalTo(self.snp_height).multipliedBy(scale)
            make.left.equalTo(self.retweetedButton.snp_right)
//            make.right.equalTo(self.commentButton.snp_left)
            make.width.equalTo(lineW)
        }
        
        separator2.snp_makeConstraints { (make) -> Void in
            make.centerY.equalTo(self.snp_centerY)
            make.height.equalTo(self.snp_height).multipliedBy(scale)
//            make.right.equalTo(self.likeButton.snp_left)
            make.left.equalTo(self.commentButton.snp_right)
            make.width.equalTo(lineW)

        }

    }
    
    
    
    
    // MARK: - 懒加载控件
    

    
    /// 转发按钮
    private lazy var retweetedButton: UIButton = UIButton(imageName: "timeline_icon_retweet", title: " 转发", fontSize: 12, color: UIColor.darkGrayColor())

    /// 评论按钮
    private lazy var commentButton: UIButton = UIButton(imageName: "timeline_icon_comment", title: " 评论", fontSize: 12, color: UIColor.darkGrayColor())

    /// 点赞按钮
    private lazy var likeButton: UIButton = UIButton(imageName: "timeline_icon_unlike", title: " 赞", fontSize: 12, color: UIColor.darkGrayColor())
    
    
  
}

    private func separatorView () -> UIView {
        let view = UIView()
        view.backgroundColor = UIColor.blackColor()
        return view
    }
